﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GoShopping.Model;
using GoShopping.Model.Enumerations;
using GoShopping.BLL;
using GoShopping.BLL.SysInfo;
using GoShopping.Utility;
/// <summary>
///EmailBean 的摘要说明
/// </summary>
public class EmailBean
{
    public static bool LogToMail(string Email, EmailTempleteType ett, string[] para)
    {

        EmailTempleteBean etb = new EmailTempleteBean();
        EmailTemplete et;
        try
        {
            et = etb.GetEmailTemplete(ett);
        }
        catch
        {
            return false;
        }
        Log_EmailSendListBean log_Mail = new GoShopping.BLL.SysInfo.Log_EmailSendListBean();
        Log_EmailSendList log = new Log_EmailSendList();
        MailSettings ms = new MailUtility().GetSmtpSettings();
        log.EmailContent = string.Format(et.ContentHTML, para);
        log.CreateDate = DateTime.Now;
        log.FromEmail = ms.MailFrom;
        log.ToUserEmail = Email;
        log.EmailTemplateName = ett.ToString();
        log_Mail.Add(log);
        return true;
    }
}
